
'use strict'

const { Sequelize, DBPoolProduction } = require('./mysqldb')

const ProductionInfo = function() {
  const tbl = DBPoolProduction.define(
    'production_info',
    {
      production_id: {
        type: Sequelize.BIGINT,
        allowNull: false,
        defaultValue: 0
      },
      source_production_id: {
        type: Sequelize.BIGINT,
        allowNull: false,
        defaultValue: 0
      },
      production_name: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        length: 255
      },
      uid: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0
      },
      image: {
        type: Sequelize.BLOB,
        allowNull: false
      },
      files_attributes: {
        type: Sequelize.TEXT,
        allowNull: false
      },
      labels: {
        type: Sequelize.STRING,
        allowNull: false,
        defaultValue: '',
        length: 255
      },
      on: {
        type: Sequelize.BOOLEAN,
        allowNull: false,
        defaultValue: true
      }
    },
    {
      tableName: 'production_info',
      timestamps: true
    }
  )

  tbl.removeAttribute('id')
  return tbl
}

const TableProductionInfo = new ProductionInfo()

module.exports = {
  TableProductionInfo
}
